package com.xnyzc.lhy.order.controller.capi.area;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.common.exception.PangException;
import com.xnyzc.lhy.common.penum.EErrorCode;
import com.xnyzc.lhy.common.util.CheckUtil;
import com.xnyzc.lhy.common.util.TokenUtil;
import com.xnyzc.lhy.order.service.area.IOaSysOpenAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description 获取开通城市
 * @Author zhuyubin
 * @Date 2019-08-20 14:51
 **/
@RestController
@RequestMapping(value = "capi/openArea")
public class OpenAreaController {

    @Autowired
    private IOaSysOpenAreaService iOaSysOpenAreaService;

    /**
     * 获取租户开通城市
     * @param search 搜索
     * @return
     */
    @GetMapping(value = "selectOpenArea")
    public Rv selectOpenArea(String search){
        String tag = TokenUtil.getTag();
        if (CheckUtil.objIsEmpty(tag)){
            throw PangException.create(EErrorCode.missingAuthArgs);
        }
        return Rv.wrap(iOaSysOpenAreaService.selectOpenArea(tag, search));
    }
}
